# 练习1：英制单位英寸与公制单位厘米互换

if __name__ == '__main__':
    while True:
        input_data = input('choose type(1.inch to cm, 2.cm to inch, -1.exit):')
        try:
            type = int(input_data)
            if type == -1:
                print('bye')
                break
            else:
                input_data = input('input num:')
                try:
                    num = float(input_data)
                    if type == 1:
                        print('{} cm'.format(round(2.54 * num, 2)))
                    elif type == 2:
                        print('{} inch'.format(round(num / 2.54, 2)))
                    else:
                        print('input error type')
                except:
                    print('input error')
        except:
            print('input error')
                
